// write by hashaki
// first edit on 2018/12/03
// last change on 2018//12/06
// 使用js调用python子进程运行量化机
function run_python_process(){
	const child_process=require('child_process');
	const http=require('http');
	/*
	// 服务端地址
	var options={
		hostname:'127.0.0.1',
    	port:6666,
    	method:'POST'
	};

	var req=http.request(options,function(res){
		res.setEncoding("utf-8");
		res.on("data",function(chunk){
			console.log(chunk.toString())
		});
		console.log(res.statusCode);
	});
	req.on("error",function(err){
		console.log(err.message);
	});
	// 发送数据到服务端
	req.write("hashaki");
	*/
    var python_file=__dirname+'/scripts'+'/run_python.py';
	var python=child_process.spawn('python',[python_file]);
	var input1=document.getElementById("contact_name").value;
	
	python.stdout.on('data',function(data){
		alert('输出：'+data);
	});
	python.stderr.on('data',function(data){
		alert("hashaki"+data);
	}
	);
	python.on('data',function(data){
		alert(data)
    });
    alert("起飞吧常鸿量化机hasaki");
}